package com.windoent.yugioh.adapter.brvah.multi;

import android.widget.TextView;

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.windoent.yugioh.R;
import com.windoent.yugioh.bean.JoinPlayerBean;
import com.windoent.yugioh.utils.SimpleUtils;
import com.windoent.yugioh.widget.RoundImageView;

import org.jetbrains.annotations.NotNull;

/**
 * author : robert
 * date   : 2021/8/6 16:54
 * desc   :
 */
public class JoinGamePlayersMultiAdapter extends BaseMultiItemQuickAdapter<JoinPlayerBean, BaseViewHolder> {
    public JoinGamePlayersMultiAdapter() {
        super(null);
        addItemType(0, R.layout.item_contsetant_palyer);
        addItemType(1, R.layout.item_contsetant_bao_ming_footer_view);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, JoinPlayerBean joinPlayerBean) {
        switch (baseViewHolder.getItemViewType()) {
            case 0:
                RoundImageView image = baseViewHolder.getView(R.id.image);
                SimpleUtils.loadImageForView(getContext(), image, joinPlayerBean.getString(), R.drawable.drawable_no_data);
                break;
            case 1:
                TextView textView = baseViewHolder.getView(R.id.tv_rv_number);
                textView.setText(joinPlayerBean.getString());
                break;
            default:
                break;
        }
    }
}
